package cn.yi.medicalsys.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.yi.medicalsys.pojo.Office;
import cn.yi.medicalsys.service.OfficeService;
import cn.yi.medicalsys.service.impl.OfficeServiceImpl;

public class OfficeServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		HttpSession session = request.getSession();
		OfficeService office=new OfficeServiceImpl();
		List<Office> list= office.findAllOffice();
		session.setAttribute("list", list);
		response.sendRedirect("staff.jsp");
		out.flush();
		out.close();
	}

	public void init() throws ServletException {
	}

}
